<template>
  <div>
    <template>
      <el-table :data="tableData" style="width: 100%" v-if="isTable">
        <el-table-column prop="name" label="发布" width="100">
        </el-table-column>
        <el-table-column prop="date" label="日期" width="100">
        </el-table-column>
        <el-table-column prop="type" label="状态" width="60px">
          <template slot-scope="scope">
            <el-tag type="success" class="tag-s" v-if="scope.row.type == 2"
              >重要</el-tag
            >
            <el-tag type="success" class="tag-u" v-else-if="scope.row.type == 1"
              >紧急</el-tag
            >
            <el-tag type="success" class="tag-o" v-else>一般</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="address" label="标题" min-width="220px">
        </el-table-column>
        <el-table-column label="">
          <template slot-scope="scope">
            <el-button
              class="view-btn"
              type="primary"
              icon="el-icon-search"
              @click="viewNotive(scope.row)"
              >查看</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </template>
  </div>
</template>
<script>
export default {
  name: "tableModule",
  components: {},
  data() {
    return {
      isTable: true,

      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
          type: 1,
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
          type: 2,
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
          type: 3,
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
          type: 1,
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
          type: 3,
        },
      ],
    };
  },
  methods: {
    viewNotive(obj) {
      console.log(obj);
    },
    changeHide() {
      this.isTable = false;
    },
    changeVisible() {
      this.isTable = true;
    },
  },
  computed: {},
  watch: {},
};
</script>
<style lang="less" scoped>
.el-table /deep/ .el-table__header-wrapper .has-gutter tr th {
  background-color: rgb(236, 236, 236) !important;
  color: #555;
}
.el-table /deep/ .el-table__body-wrapper tr td {
  height: 56px;
}
.el-table /deep/ .el-table__body-wrapper {
  height: 316px;

  box-sizing: border-box;
  overflow: hidden;
}
.view-btn {
  padding: 4px 6px;
  font-size: 12px;
  background-color: rgb(255, 255, 255);
  color: #41b6e6;
}
.el-tag {
  font-size: 12px !important;
  line-height: 20px;
  padding: 0 6px;
  text-align: center;
  height: 20px;
  border: none;
  color: #fff;
}
.tag-u {
  background-color: rgb(206, 34, 34);
}
.tag-s {
  background-color: #f2b612;
}
.tag-o {
  background-color: #41b6e6;
}
</style>
